<template>
  <div class="timeline-demo">
    <alert v-model="alertShow.showmsg" :title="'提示'" @on-show="onShow" @on-hide="onHide">{{alertShow.msg}}</alert>
    <x-header style="background-color:#3d82e5;width:100%;position:absolute;left:0;top:0;z-index:100;" :left-options="{showBack: false}">
      <p name="content">查看物流</p>
    </x-header>
    <div style="padding-top: 38px">
      <timeline>
        <timeline-item>
          <h4 class="recent">【广东】 广州市 已发出</h4>
          <p  class="recent">2016-04-17 12:00:00</p>
        </timeline-item>
        <timeline-item>
          <h4 style="color: #666;"> 申通快递员 广东广州 收件员 xxx 已揽件</h4>
          <p style="color: #888;">2016-04-16 10:23:00</p>
        </timeline-item>
        <timeline-item>
          <h4 style="color: #666;"> 商家正在通知快递公司揽件</h4>
          <p style="color: #888;">2016-04-15 9:00:00</p>
        </timeline-item>
      </timeline>
    </div>
    <x-button style="font-size: 15px;width: 200px;background-color: #3d82e5;color: #ffffff" @click.native="goBackfn">确定</x-button>
  </div>
</template>
<script>
  import { Timeline, TimelineItem, XButton, Alert, XHeader } from 'vux'
//  import * as urls from '../../../../api/urls'
  import * as types from '../../../../store/types'

  export default {
    components: {
      Timeline,
      TimelineItem,
      XButton,
      Alert,
      XHeader
    },
    mounted: function () {
      this.getLogisticsList()
      this.weixinfn46()
    },
    data () {
      return {
        alertShow: {
          showmsg: false,
          msg: ''
        },
        itemArry: []
      }
    },
    methods: {
      weixinfn46 () {
        let that = this
        let userId = this.$store.state.userInfo.id
        let logo = this.$store.state.empower.LOGO
        let url = window.location.origin
        let link = url + '/api/wxAuth/index?type=t1' + '&uid=' + userId
        that.$wechat.onMenuShareAppMessage({
          title: '孝行通', // 分享标题
          desc: '孝行通·微商城 一个让子女为父母尽孝的老年服务平台', // 分享描述
          link: link, // 分享链接
          imgUrl: logo, // 分享图标
          success: function () {
            // 用户确认分享后执行的回调函数
          },
          cancel: function () {
            // 用户取消分享后执行的回调函数
          }
        })
        that.$wechat.onMenuShareTimeline({
          title: '孝行通', // 分享标题
          link: link, // 分享链接
          imgUrl: logo, // 分享图标
          success: function () {
            // 用户确认分享后执行的回调函数
          },
          cancel: function () {
            // 用户取消分享后执行的回调函数
          }
        })
      },
      getLogisticsList () {
//        let userId = this.$store.state.userInfo.id
//        let that = this
//        this.http(urls.calCart, {userId: userId}, function (res) {
//          if (res.status === 100) {
//            if (res.data.list.length !== 0) {
//              that.itemArry = res.data.list
//            }
//            that.carMoney = res.data.total
//          } else {
//            that.alertShow.showmsg = true
//            that.alertShow.msg = res.errMsg
//          }
//        }, function (res) {
//          that.alertShow.showmsg = true
//          that.alertShow.msg = res
//        })
      },
      goBackfn () {
        let that = this
        that.$store.commit(types.USER_ORDER, {index: 3})
        that.$router.push({
          path: '/order/OrderIndex'
        })
        that.$router.go(1)
      },
      onShow () {
        // 弹窗出现时触发
      },
      onHide () {
        // 弹窗关闭时触发
      }
    }
  }
</script>
<style scoped="scoped">
  .recent {
    color: rgb(4, 190, 2)
  }
</style>
